class Solution:
    def removeDuplicates(self, nums: list[int]) -> int:
        slow, fast, n = 1, 1, len(nums)
        while fast < n:
            if nums[slow - 1] != nums[fast]:
                nums[slow] = nums[fast]
                slow += 1
            fast += 1
        return slow